package com.config;
import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。*/
public class AlipayConfig {
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016092600600535";
    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDRlw40LStNlNwWYGBe0wPiJP5k6afmFJmAeK88KdGc3htzjQSzTD/e0EZ0wSCuW4PknJNr8Dbh4Sq7KqIWxOJha0LCUuLYu8+NPM3LDqWmhdtaa4Cu8F6e7GrzA0pBcTyb/6KNU9QvSebGCnKLUqi38H9Jo91mtC50L2Wbd4KDaURu8/iIYlhhP9bEYcZjkZqlcp3TdnWMs8YyorzDgNN46vatDWC/w10hiU3UEeVrq/XMT1YHjoGgWZX2+OrfnuQXw/pWnN2AzcQ4qFUkkN1ciqashnQGql9Jo0tMrVyNnfDLW/+mn3/5+x0Mqhcg/ZINWqLxhkhYneCASwNfwmJrAgMBAAECggEAMXX+ah3GvFZG4hj4ZShTIEkup83kS43M896HLCGKUASyYcCDvXRfFkv8dI0nEz6Rj5/Lwos7yG6E0Qqsmcb4zZisdoNs+UzJHEGfJy5btUKdk2cPRTmAeuy8CIFcQrlgXkgjqkqAJnDAPzgz8+Eb49yjjVNYamZXGCAfUGMRr8T4f++ZB//GtP1swCfari+s3WVzFNVofo9F2MbpNexNhEEOej8bMeWoTP+Th16EpK8E3wp9n+LMHwapjTducZKxwkHfdfmqC5HxXLuUSP9pGaNfN3+ms47WUiyJPIC0ykyQXJeDci/KzPO3AbZiLkfrxW+W0h7+4SZcz4guH4jSYQKBgQDtACw6s0hN90F/ziiuvyThGno7RfGbDtEMe677CTh4+vxJj5Xfh1LMvBx2sSFUGoiY0Ls1qpitCeyKvNEgaovZqJfRtQJCXZA+/YEmUmNwFo2vVDpMSSTUytV1+baxTO23L0nrBrHsuKE7M3lfYubs451gkYCYll522GgsgIPrwwKBgQDiZFnASfLVM6qOOIWmbEXgF6Cup/6oTib7IQpvDQ2JD68A4ckeFn47q4KdWlLKI1wUSI7aCsl4QtK7gzwW+qq0i2JKM75K7+2OhbkGsDeFr/tt4QoTGJFUDd5+q+JasR+LuUVs9Bfd7XRu2f6ysxiQe68386xJbeA8ooowsLdMOQKBgHw/mPB1STTGqaoNNLrYLsdskCQ++PknfWUj+opVPSv/uP//rLzxPvFitTFsj2J+PpqO43axJzWgfEgH0UNDWGoVvvIMCVEtqA+961Vh4AvFZyZB7AZOWmbMp7gf4C13fTCKNCBo9CJ8cNqOk9T0DsimU71qypY0TvXTYlniTkbtAoGAPqKtAjpzaPFGetrAf27tVjazSh9IoaAdwNU/YcImwIkKTiAp2J04h6HIHWjkBvEJhMMeYs0hOJikXSTN9z2bBSCbLRRrzafb/daZfnQ6qE4sLhZZBzeA3dSIfltn4NeodqvnvWE7STdtQ04k3aQXY8IUlFJilF5F8AC4YwhBbmECgYAaayD9b7blL7/7qwCFjoPslrsS1ZfuwN3D/YZKogfPJD6IZlCnwu1O0TIL+YeZzOo85b5WhRbCeXc3wqloNb2/NPg7m6qnzqJ2DgI5gj143MqIXEOp/CPxQDa1Hah7cKVRAO7RT57RCn4FIWY+XDiZxsoHHmOg27QfGVJngW17uQ==";
    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = " MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ZcONC0rTZTcFmBgXtMD4iT+ZOmn5hSZgHivPCnRnN4bc40Es0w/3tBGdMEgrluD5JyTa/A24eEquyqiFsTiYWtCwlLi2LvPjTzNyw6lpoXbWmuArvBenuxq8wNKQXE8m/+ijVPUL0nmxgpyi1Kot/B/SaPdZrQudC9lm3eCg2lEbvP4iGJYYT/WxGHGY5GapXKd03Z1jLPGMqK8w4DTeOr2rQ1gv8NdIYlN1BHla6v1zE9WB46BoFmV9vjq357kF8P6VpzdgM3EOKhVJJDdXIqmrIZ0BqpfSaNLTK1cjZ3wy1v/pp9/+fsdDKoXIP2SDVqi8YZIWJ3ggEsDX8JiawIDAQAB";
    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";
    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";
    // 签名方式
    public static String sign_type = "RSA2";
    // 字符编码格式
    public static String charset = "utf-8";
    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
    // 支付宝网关
    public static String log_path = "C:\\";
//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

